﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using entity;
using DAL;

namespace BLL
{
    /// <summary>
    ///StockScoreBLL 的摘要说明
    /// </summary>
    public class StockScoreBLL
    {
        public StockScore GetStockScore(string stockId)
        {
            QgqpDAL dal = new QgqpDAL();
            return dal.GetStockScore(stockId);
        }

        public string GetStockScoreStr(string stockId)
        {
            string key = "StockScoreBLL_GetStockScoreStr:" + stockId;
            string str = (string)MemcachedTools.Get(key);
            if (!string.IsNullOrEmpty(str))
            {
                return str;
            }
            var c = GetStockScore(stockId);
            if (c != null)
            {
                str = Newtonsoft.Json.JsonConvert.SerializeObject(c);
                MemcachedTools.Add(key, str, DateTime.Now.AddMinutes(10));
                return str;
            }
            else
            {
                return Newtonsoft.Json.JsonConvert.SerializeObject(new StockScore());
            }
        }
    }
}